import java.io.*;
import java.util.Arrays;

public class Demo4 {
    public static void main(String[] args) throws IOException {
        //1.打开文件
        InputStream io = new FileInputStream("./text2.txt");

        //2.操作文件
        while(true) {
            int input = io.read();
            if(input == -1) {
                break;
            }
            System.out.println(input);
        }

        byte[] b = new byte[1024];
        int input = io.read(b);
        System.out.println(input);
        String s = new String(b,0, 11,"utf8");
        System.out.println(s);
        //3.关闭文件
        io.close();
    }
}
